﻿@model NFine.Domain.Entity.Biz.UserOrderEntity
@{
    ViewBag.Title = "订单详情";
    Layout = "~/Views/Shared/_LayoutWeui.cshtml";
}
@section heardStyle
{
    <!-- 字体图标 -->
    <link rel="stylesheet" href="~/Content/M/css/iconfonts.css" />
    <link rel="stylesheet" href="~/Content/M/css/list.css" />
    <style>
        .weui-tabbar a {
            display: block;
            height: 60px;
            line-height: 60px;
            width: 33.2%;
            font-size: .8rem;
            text-align: center;
            color: #333;
        }

        .weui-tabbar .split {
            width: 0.3%;
            background-color: #c0bfc4;
        }
    </style>
}
@*<header class="header">
        <span style="margin-left: 0.5rem;">
            <a href="javascript:location.replace('OrderList?type=@ViewData["nowType"]&userType=0')">
                <span class="icon"></span>
            </a>
        </span>
        <span class="title"><strong>订单详情 </strong></span>
    </header>*@
<div style="height:.5rem;"></div>
<div class="weui-panel order" style="margin-top:0; padding:0;">
    <div class="weui-media-box weui-media-box_appmsg" style="">
        <div style="margin-right:0.5rem;margin-left:0.2rem;">
            <span class="icon-book-line-4 fs-20"></span>
        </div>
        <div class="weui-media-box__bd">
            <p class="weui-media-box__desc">订单编号：@Model.OrderCode</p>
            <p class="weui-media-box__desc">
                订单状态：<span class="price">
                    @if (Model.IsPay == 0)
                    {
                        @:未支付
                                                                    }
                    @if (Model.IsPay == 1 && Model.OrderStatus != 2)
                    {
                        @:已支付
                                                                    }
                    @if (Model.IsPay == 1 && Model.OrderStatus == 2)
                    {
                        @:已完成
                                                                    }
                </span>
            </p>
            <p class="weui-media-box__desc">下单时间：@Model.OrderTime</p>
        </div>
    </div>

    <div class="weui-media-box weui-media-box_appmsg addr">
        <div style="margin-right:0.5rem;margin-left:0.2rem;">
            <span class="icon-message-line-3 fs-20"></span>
        </div>
        <div class="weui-media-box__bd">

            <p class="weui-media-box__desc">
                预约时间：@Model.FixTime
            </p>

            <p class="weui-media-box__desc">
                收货人：@Model.Consignee &nbsp;&nbsp;&nbsp; 电话：@Model.ContactNumber
            </p>
            <p class="weui-media-box__desc">
                收货地址：@Model.Address
            </p>

            <p class="weui-media-box__desc">
                备注：@Model.Remark
            </p>
        </div>
    </div>
</div>

<div class="weui-panel" style="padding-left:0.5rem;">
    <div class="weui-media-box " style="padding: 0.5rem 0.5rem 0.1rem 0.5rem">
        <div class="weui-media-box_appmsg">
            <div class="weui-media-box__hd" style="height:70px;width:70px">
                <img class="weui-media-box__thumb" src="@Model.ProductImageUrl" style="width:100%;height:100%">
            </div>
            <div class="weui-media-box__bd">
                <div style="height:50px;">
                    <p class="weui-media-box__desc"><a href="ProductInfo?pid=@Model.ProductId"> @Model.ProductName</a></p>
                </div>
                <div><span>@Model.ProductSubName</span>
    <span class="price">￥@Model.ProductPrice </span><span class="right"> ×@Model.ProductNumber</span>
</div>
            </div>
        </div>
    </div>
</div>
<div class="weui-panel" style="padding-left:0.5rem;padding-bottom:0rem;">
    <div class="weui-media-box" style="padding: 0.3rem 0.5rem 0.3rem 0.5rem">
        <div class="weui-media-box__bd">
            实付总额<span class="price right">￥@Model.TotalMoney</span>
        </div>
    </div>
</div>


<div style="height: 60px;"></div>
<div class="weui-tabbar">
    <a href="tel:@ViewData["callphone"]">
        联系供货商
    </a>
    <a class="split"></a>
    @if ((bool)ViewData["isAdmin"])
    {
        <a id="sqfh" href="javascript:btn_fh('@Model.Id','@Model.ProductId');">
            申请发货
        </a>
        <a id="sqfhsplit" class="split"></a>
        <a id="tdcl" href="javascript:btn_th('@Model.Id','@Model.ProductId');">
            退单处理
        </a>
    }
</div>

@*@if (Model.IsPay == 0)
    {
        <div style="margin-top: 0.3rem;"></div>
        <a href="javascript:;" class="weui-btn weui-btn_primary" >支付</a>
    }*@

@section footScript
{
    <script type="text/javascript">
        var ispost = false;
        //申请发货
        function btn_fh(Id, ProductId) {
            $("#sqfh").hide();
            $("#sqfhsplit").hide();
            $("#tdcl").hide();
            $.post("../Biz/UserOrder/SendOrder", { Id: Id, productId: ProductId },
                function (json) {
                    if (json.toString().indexOf("success") > -1) {
                        $.toast("操作成功！", function () {
                            // $(".weui-tabbar").hide();
                        });
                    }
                    else {

                        $("#sqfh").show();
                        $("#sqfhsplit").show();
                        $("#tdcl").show();
                    }
                    //if (json.state == 'success')
                    //    top.$.NoticeSender.sendToSupplier('info|新发货申请', '有新订单申请发货，请及时处理！', json.data);
                    //$.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            );
        }
        function btn_th(Id, ProductId) {
            $("#sqfh").hide();
            $("#sqfhsplit").hide();
            $("#tdcl").hide();
            $.post("../Biz/UserOrder/BackOrder", { Id: Id, productId: ProductId },
                function (json) {
                    if (json.toString().indexOf("success") > -1) {
                        $.toast("退单成功！", function () {
                            // $(".weui-tabbar").hide();
                        });
                    }
                    else {

                        $("#sqfh").show();
                        $("#sqfhsplit").show();
                        $("#tdcl").show();
                    }
                    //if (json.state == 'success')
                    //    top.$.NoticeSender.sendToSupplier('info|新发货申请', '有新订单申请发货，请及时处理！', json.data);
                    //$.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            );
        }
    </script>
}